import type { RouteRecordRaw } from 'vue-router';

import { BasicLayout } from '#/layouts';
import { $t } from '#/locales';

const routes: RouteRecordRaw[] = [
  {
    component: BasicLayout,
    meta: {
      icon: 'lucide:workflow',
      order: 3,
      title: $t('page.workflow.title'),
      permission: 'workflow:menu', // 工作流菜单权限
    },
    name: 'Workflow',
    path: '/workflow',
    children: [
      {
        name: 'WorkflowModel',
        path: '/workflow/model',
        component: () => import('#/views/workflow/model/index.vue'),
        meta: {
          icon: 'lucide:file-code',
          title: $t('page.workflow.model'),
          permission: 'workflow:model:view', // 流程模型权限
        },
      },
      {
        name: 'WorkflowModelDesigner',
        path: '/workflow/model/designer/:id',
        component: () => import('#/views/workflow/model/designer.vue'),
        meta: {
          hideInMenu: true,
          title: $t('page.workflow.designer'),
        },
      },
      {
        name: 'WorkflowDefinition',
        path: '/workflow/definition',
        component: () => import('#/views/workflow/definition/index.vue'),
        meta: {
          icon: 'lucide:file-check',
          title: $t('page.workflow.definition'),
          permission: 'workflow:definition:view', // 流程定义权限
        },
      },
      {
        name: 'WorkflowInstance',
        path: '/workflow/instance',
        component: () => import('#/views/workflow/instance/index.vue'),
        meta: {
          icon: 'lucide:play-circle',
          title: $t('page.workflow.instance'),
          permission: 'workflow:instance:view', // 流程实例权限
        },
      },
      {
        name: 'WorkflowInstanceDetail',
        path: '/workflow/instance/detail/:id',
        component: () => import('#/views/workflow/instance/detail.vue'),
        meta: {
          hideInMenu: true,
          title: $t('page.workflow.instanceDetail'),
        },
      },
      {
        name: 'WorkflowTask',
        path: '/workflow/task',
        meta: {
          icon: 'lucide:list-checks',
          title: $t('page.workflow.task'),
          permission: 'workflow:task:menu', // 任务管理菜单权限
        },
        children: [
          {
            name: 'WorkflowTaskTodo',
            path: '/workflow/task/todo',
            component: () => import('#/views/workflow/task/todo/index.vue'),
            meta: {
              icon: 'lucide:inbox',
              title: $t('page.workflow.taskTodo'),
              permission: 'workflow:task:todo:view', // 待办任务权限
            },
          },
          {
            name: 'WorkflowTaskDone',
            path: '/workflow/task/done',
            component: () => import('#/views/workflow/task/done/index.vue'),
            meta: {
              icon: 'lucide:check-circle',
              title: $t('page.workflow.taskDone'),
              permission: 'workflow:task:done:view', // 已办任务权限
            },
          },
        ],
      },
      {
        name: 'WorkflowMonitor',
        path: '/workflow/monitor',
        component: () => import('#/views/workflow/monitor/index.vue'),
        meta: {
          icon: 'lucide:activity',
          title: $t('page.workflow.monitor'),
          permission: 'workflow:monitor:view', // 流程监控权限
        },
      },
      {
        name: 'WorkflowTestDesigner',
        path: '/workflow/test-designer',
        component: () => import('#/views/workflow/test-designer.vue'),
        meta: {
          hideInMenu: true,
          icon: 'lucide:test-tube',
          title: 'BPMN 设计器测试',
        },
      },
    ],
  },
];

export default routes;

